package com.shida.service;

import com.shida.dao.BooksMapper;
import com.shida.entity.Books;
import java.util.List;

public class BooksServiceImpl implements BooksService {
    //调用dao层的操作，设置一个set接口，方便Spring管理
    private BooksMapper booksMapper;

    public void setBooksMapper(BooksMapper booksMapper) {
        this.booksMapper = booksMapper;
    }

    @Override
    public int addBooks(Books books) {
        return booksMapper.addBook(books);
    }

    @Override
    public int deleteBooks(int id) {
        return booksMapper.deleteBookById(id);
    }

    @Override
    public int updateBooks(Books books) {
        return booksMapper.updateBook(books);
    }

    @Override
    public Books queryBooksById(int id) {
        return booksMapper.queryBookById(id);
    }

    /**
     * 功能描述: 查询所有书籍
     *
     * @return java.util.List<com.shida.entity.Books>
     * @author jiaoqianjin
     * @date 2021/3/19
     */
    public List<Books> queryAllBooks() {
        return booksMapper.queryAllBooks();
    }

    public int addBook(Books book) {
        return booksMapper.addBook(book);
    }

    public int deleteBookById(int id) {
        return booksMapper.deleteBookById(id);
    }

    public int updateBook(Books books) {
        return booksMapper.updateBook(books);
    }

    public Books queryBookById(int id) {
        return booksMapper.queryBookById(id);
    }
}
